{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b7bff4fc",
   "metadata": {},
   "source": [
    "### 提前当前时间（秒）并检验"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e254f0ff",
   "metadata": {},
   "outputs": [],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,57,59]\n",
    "\n",
    "right_this_minute = datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "724a6cbb",
   "metadata": {},
   "source": [
    "提前当前一段时间并依次检验"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5066e32d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute\n",
      "This minute seems a little odd.\n",
      "Not an odd minute\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "import random\n",
    "import time\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "for i in range(5):\n",
    "    right_this_minute = datetime.today().minute\n",
    "    if right_this_minute in odds:\n",
    "        print(\"This minute seems a little odd.\")\n",
    "    else:\n",
    "        print(\"Not an odd minute\")\n",
    "    wait_time = random.randint(1,60)\n",
    "    time.sleep(wait_time)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c2c15d32",
   "metadata": {},
   "source": [
    "# 数字间隔计算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "7cb276f9",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "unexpected EOF while parsing (<ipython-input-1-fd50010d863e>, line 13)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-1-fd50010d863e>\"\u001b[1;36m, line \u001b[1;32m13\u001b[0m\n\u001b[1;33m    print(new_num,word,\"of beer on the wall.\"\u001b[0m\n\u001b[1;37m                                             ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unexpected EOF while parsing\n"
     ]
    }
   ],
   "source": [
    "word = \"bottles\"\n",
    "for beer_num in range(99,0,-1):\n",
    "    print(beer_num,word,\"of beer on the wall.\")\n",
    "    print(beer_num,word,\"of beer.\")\n",
    "    print(\"Take one down.\")\n",
    "    print(\"Pass it around.\")\n",
    "    if beer_num == 1:\n",
    "        print(\"No more bottles of beer on the wall.\")\n",
    "    else:\n",
    "        new_num = beer_num - 1\n",
    "        if new_num == 1:\n",
    "            word = \"bottle\"\n",
    "        print(new_num,word,\"of beer on the wall.\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dead485e",
   "metadata": {},
   "source": [
    " #  常见的数字模型:\n",
    " #  整形(int):用来存放整数,33,66,897\n",
    "#  浮点型(float):用来存放小数,0.78,3.64\n",
    "#  字符串型(str):用来存放字符串,'课堂'\n",
    "\n",
    "#  注意:input函数取得的参数都是字符串型\n",
    "\n",
    "#  只有相同的数字模型才可以进行数字运算\n",
    "\n",
    "# 可以通过int(),float(),str()来进行类型转换\n",
    " \n",
    "# 可以用type()来判断数据的模型\n",
    "\n",
    "# 注释:在Python中注释符号是#,用来忽略一段代码\n",
    "\n",
    "# 在Python中用and表示而且的意思,and运算符将考察左右两边变量的真假,若两边变量均为真,则输出结果为真,若有一边变量为假,则输出结果为假\n",
    "\n",
    "# 用or表示或者的意思,or运算符将考察左右两边变量的真假,只要有一边为真,则输出结果为真,只有左右两边变量都为假时,输出结果才为假\n",
    "\n",
    "# not运算符仅计算单个变量,被称作单目运算符,会转换变量的真假"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a77950c8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
